home *** CD-ROM | disk | FTP | other *** search
Wrap
class com.mosesSupposes.fuse.FuseKitCommon { static var logOutput; static var VERSION = "Fuse Kit 2.1.3r1 Copyright (c) 2006 Moses Gunesch, MosesSupposes.com under MIT Open Source License"; static var VERBOSE = true; static var ALL = "ALL"; static var ALLCOLOR = "ALLCOLOR"; static var cbTicker = 0; function FuseKitCommon() { } static function _cts() { return "|_tint|_tintPercent|_brightness|_brightOffset|_contrast|_invertColor|_colorReset|_colorTransform|"; } static function _resetTo100() { return "|_alpha|_contrast|_invertColor|_tintPercent|_xscale|_yscale|_scale|"; } static function _resetTo0() { return "|_brightness|_brightOffset|_colorReset|_rotation|"; } static function _underscoreable() { return com.mosesSupposes.fuse.FuseKitCommon._cts() + "_frame|_x|_y|_xscale|_yscale|_scale|_width|_height|_size|_rotation|_alpha|_fade|_visible|"; } static function _cbprops() { return "|skipLevel|cycles|roundResults|extra1|extra2|func|scope|args|startfunc|startscope|startargs|updfunc|updscope|updargs|"; } static function _fuseEvents() { return "|onStart|onStop|onPause|onResume|onAdvance|onComplete|"; } static function _fuseprops() { return "|command|label|delay|event|eventparams|target|addTarget|trigger|startAt|ease|easing|seconds|duration|time|"; } static function _validateFuseCommand(c, inGroup, hasArg, outputLevel, simple) { var _loc1_ = false; var _loc2_ = false; switch(c) { case "start": case "stop": case "pause": case "resume": case "setStartProps": if(inGroup != true) { _loc1_ = true; } break; case "delay": case "trigger": if(simple == true) { if(hasArg == true) { _loc1_ = true; } } else { _loc2_ = true; } inGroup = false; break; case "skipTo": if(hasArg == true && inGroup != true) { _loc1_ = true; break; } } if(outputLevel > 0 && _loc1_ == false) { com.mosesSupposes.fuse.FuseKitCommon.error("109",c,inGroup,_loc2_); } return _loc1_; } static function output(s) { if(typeof com.mosesSupposes.fuse.FuseKitCommon.logOutput == "function") { com.mosesSupposes.fuse.FuseKitCommon.logOutput(s); } else { trace(s); } } static function error(errorCode) { var _loc3_ = arguments[1]; var _loc4_ = arguments[2]; var _loc6_ = arguments[3]; if(com.mosesSupposes.fuse.FuseKitCommon.VERBOSE != true) { com.mosesSupposes.fuse.FuseKitCommon.output("[FuseKitCommon#" + errorCode + "]"); return undefined; } var _loc2_ = ""; var _loc5_ = "\n"; switch(errorCode) { case "001": _loc2_ += "** ERROR: When using simpleSetup to extend prototypes, you must pass the Shortcuts class. **"; _loc2_ += _loc5_ + " import com.mosesSupposes.fuse.*;"; _loc2_ += _loc5_ + " ZigoEngine.simpleSetup(Shortcuts);" + _loc5_; break; case "002": _loc2_ += "** ZigoEngine.doShortcut: shortcuts missing. Use the setup commands: import com.mosesSupposes.fuse.*; ZigoEngine.register(Shortcuts); **"; break; case "003": _loc2_ += _loc5_ + "*** Error: DO NOT use #include \"lmc_tween.as\" with this version of ZigoEngine! ***" + _loc5_; break; case "004": _loc2_ += "** ZigoEngine.doTween - too few arguments [" + _loc3_ + "]."; if(Boolean(_loc4_) == true) { _loc2_ += " If you are trying to use Object Syntax without Fuse, pass FuseItem in your register() or simpleSetup() call. **"; } else { _loc2_ += " Object syntax call failed. **"; } break; case "005": _loc2_ += "** ZigoEngine.doTween - missing targets[" + _loc3_ + "] and/or props[" + _loc4_ + "] **"; break; case "006": _loc2_ += "** Error: easing shortcut string not recognized (\"" + _loc3_ + "\"). You may need to pass the in PennerEasing class during register or simpleSetup. **"; break; case "007": _loc2_ += "- ZigoEngine: Target locked [" + _loc3_ + "], ignoring tween call [" + _loc4_ + "]"; break; case "008": _loc2_ += "** You must register the Shortcuts class in order to use easy string-type callback parsing. **"; break; case "009": _loc2_ += "** ZigoEngine: A callback parameter \"" + _loc3_ + "\" was not recognized. **"; break; case "010": _loc2_ += "** " + (_loc3_ != true ? "FuseItem" : "ZigoEngine") + " unable to parse " + (_loc4_ != 1 ? String(_loc4_) + " callbacks[" : "callback[") + _loc6_ + "]. Try using the syntax {scope:this, func:\"myFunction\"} **"; break; case "011": _loc2_ += "- ZigoEngine: Callbacks discarded via skipLevel 2 option [" + _loc3_ + "|" + _loc4_ + "]."; break; case "012": _loc2_ += "- Engine set props or ignored no-change tween on: " + _loc3_ + ", props passed:[" + _loc4_ + "], endvals passed:[" + _loc6_ + "]"; break; case "013": _loc2_ += "- Engine added tween on:\n\ttargets:[" + _loc3_ + "]\n\tprops:[" + _loc4_ + "]\n\tendvals:[" + _loc6_ + "]"; break; case "014": _loc2_ += "** Error: easing function passed is not usable with this engine. Functions need to follow the Robert Penner model. **"; break; case "015": _loc2_ += "** Error: The CustomEasing class must be passed during setup (register or simpleSetup) to use custom easing Arrays. **"; break; case "016": _loc2_ += "[ ZigoEngine.TIME_MULTIPLIER: " + String(Number(Number(_loc3_) * 100)) + "% ]"; break; case "101": _loc2_ += "** ERROR: Fuse simpleSetup was removed in version 2.0! **"; _loc2_ += _loc5_ + " You must now use the following commands:"; _loc2_ += _loc5_ + _loc5_ + "\timport com.mosesSupposes.fuse.*;"; _loc2_ += _loc5_ + "\tZigoEngine.simpleSetup(Shortcuts, PennerEasing, Fuse);"; _loc2_ += _loc5_ + "Note that PennerEasing is optional, and FuseFMP is also accepted. (FuseFMP.simpleSetup is run automatically if included.)" + _loc5_; break; case "102": _loc2_ += "** Fuse " + _loc3_ + " index or label not found (" + _loc4_ + ") or out of range. **"; break; case "103": _loc2_ += "** Fuse skipTo (" + _loc3_ + ") ignored - targets the current index (" + _loc4_ + "). **"; break; case "104": _loc2_ += "** Fuse fastForward index out of play range (" + _loc3_ + ") - skipTo has been called instead. **"; break; case "105": _loc2_ += "** An unsupported Array method was called on Fuse. **"; break; case "106": _loc2_ += "** ERROR: You have not set up Fuse correctly. **"; _loc2_ += _loc5_ + "You must now use the following commands (PennerEasing is optional)."; _loc2_ += _loc5_ + "\timport com.mosesSupposes.fuse.*;"; _loc2_ += _loc5_ + "\tZigoEngine.simpleSetup(Shortcuts, PennerEasing, Fuse);" + _loc5_; break; case "107": _loc2_ += "** Fuse :: id not found - Aborting open(). **"; break; case "108": _loc2_ += "** Fuse.startRecent: No recent Fuse found to start! **"; break; case "109": _loc2_ += "** Command \"" + _loc3_ + "\" discarded. "; if(_loc4_ == true) { _loc2_ += "Not allowed within a group. **"; } else if(_loc6_ == true) { _loc2_ += "Not supported in Object Syntax, use the " + _loc3_ + " property instead. **"; } else { _loc2_ += "The command may be unrecognized or missing an argument. **"; } break; case "110": _loc2_ += "** " + _loc3_ + " illegal Fuse property discarded:\"" + _loc4_ + "\". Bezier keywords other than x and y cannot be set as start values. **"; break; case "112": _loc2_ += "** Fuse: missing com.mosesSupposes.fuse.ZigoEngine! Cannot tween. **"; break; case "113": _loc2_ += "** FuseItem: A callback has been discarded. Actions with a command may only contain: label, delay, scope, args. **"; break; case "115": _loc2_ += _loc3_ + " overlapping prop discarded: " + _loc4_; break; case "116": _loc2_ += "** FuseItem Error: Delays within groups (arrays) and start/update callbacks are not supported when using Fuse without ZigoEngine. Although you need to restructure your Fuse, it should be possible to achieve the same results. **" + _loc5_; break; case "117": _loc2_ += "** " + _loc3_ + ": infinite cycles are not allowed within Fuses - discarded. **"; break; case "118": _loc2_ += "** " + _loc3_ + ": No targets found!" + (_loc4_ != true ? " [Skipping tween parameters in this action] **" : " [Unable to set start props] **"); break; case "119": _loc2_ += "** " + _loc3_ + ": " + (_loc4_ != 1 ? _loc4_ + " actions in the group" : "") + " missing targets" + (_loc6_ != true ? " **" : " during setStartProps **"); break; case "120": _loc2_ += "** " + _loc3_ + ": conflict with \"" + _loc4_ + "\". Property might be doubled within a grouped-action array. **"; break; case "121": _loc2_ += "** Fuse timecode formatting requires \"00:\" formatting (example:\"01:01:33\" yields 61.33 seconds.) **"; break; case "122": _loc2_ += "** Event \"" + _loc3_ + "\" reserved by Fuse. **"; break; case "123": _loc2_ += "** A Fuse event parameter failed in " + _loc3_ + " **"; break; case "124": _loc2_ += "** " + _loc3_ + ": trigger:" + _loc4_ + " ignored - only one trigger is allowed per action **"; break; case "125": _loc2_ += _loc3_ + " Warning - fastForward hit an item during its tween cycle, may malfunction."; break; case "201": _loc2_ += "**** FuseFMP cannot initialize argument " + _loc3_ + " (BitmapFilters cannot be applied to this object type) ****"; break; case "202": _loc2_ += "** FuseFMP error: A " + _loc3_ + " could not be created for " + _loc4_ + " **"; break; case "203": _loc2_ += "** FuseFMP.setFilterProps - too few arguments passed (" + _loc3_ + ") - minimum 2 required. **"; break; case "204": _loc2_ += "** FuseFMP.setFilterProps could not locate the filter passed. (" + _loc3_ + ") **"; } com.mosesSupposes.fuse.FuseKitCommon.output(_loc2_); } static function parseCallback(callback, targets, outputLevel, callerIsEngine, addprefix) { if(callback._vcb == true) { return callback; } var validCBs = {_vcb:true,skipLevel:_global.com.mosesSupposes.fuse.ZigoEngine.SKIP_LEVEL,cycles:1}; if(callback == undefined) { return validCBs; } var cbErrors = []; if(typeof callback == "object") { if(callback.skipLevel != undefined && typeof callback.skipLevel == "number" && callback.skipLevel != _global.com.mosesSupposes.fuse.ZigoEngine.SKIP_LEVEL) { if(callback.skipLevel >= 0 && callback.skipLevel <= 2) { validCBs.skipLevel = callback.skipLevel; } } if(callback.cycles != undefined) { if(typeof callback.cycles == "number" && callback.cycles > -1) { validCBs.cycles = callback.cycles; } else if(callback.cycles.toUpperCase() == "LOOP") { validCBs.cycles = 0; } } if(callback.extra1 != undefined) { validCBs.extra1 = callback.extra1; } if(callback.extra2 != undefined) { validCBs.extra2 = callback.extra2; } if(callback.roundResults === true || callback.roundResults === false) { validCBs.roundResults = callback.roundResults; } } else { callback = {func:callback}; } var prefixes = ["start","upd",""]; var easyfuncparse = _global.com.mosesSupposes.fuse.Shortcuts.parseStringTypeCallback; for(var i in prefixes) { var prefix = prefixes[i]; var fstr = callback[prefix + "func"]; if(fstr != undefined && typeof fstr == "string" && fstr.indexOf("(") > -1) { if(easyfuncparse != undefined) { var efc = easyfuncparse(fstr); if(efc.func != undefined) { callback[prefix + "scope"] = efc.scope; callback[prefix + "func"] = efc.func; callback[prefix + "args"] = efc.args; } } else if(outputLevel > 0) { com.mosesSupposes.fuse.FuseKitCommon.error("008"); } } } var basescope = callback.scope; for(var i in callback) { var fi = i.toLowerCase().indexOf("func"); if(fi > -1) { var prefix = i.slice(0,fi); var func = callback[i]; var args = callback[prefix + "args"]; var scope = callback[prefix + "scope"] != undefined ? callback[prefix + "scope"] : basescope; if(typeof func == "string" && scope[func] == undefined) { for(var j in targets) { var targ = targets[j]; if(typeof targ[func] == "function") { scope = targ; break; } if(typeof targ._parent[func] == "function") { scope = targ._parent; break; } } if(scope == undefined && _level0[func] != undefined) { scope = _level0; } if(scope == undefined && _global[func] != undefined) { scope = _global; } } if(typeof func != "function") { if(typeof scope[String(func)] == "function") { func = scope[String(func)]; } else { func = eval(String(func)); } } if(func == undefined) { cbErrors.push(String((addprefix != null ? addprefix + i : i) + ":" + (typeof callback[i] != "string" ? callback[i] : "\"" + callback[i] + "\"") + "/" + prefix + "scope:" + scope)); } else { if(args != undefined && !(args instanceof Array)) { args = [args]; } if(prefix == "") { prefix = "end"; } validCBs[prefix] = {s:scope,f:func,a:args}; if(callerIsEngine == true) { validCBs[prefix].id = ++com.mosesSupposes.fuse.FuseKitCommon.cbTicker; } if(prefix == "start") { validCBs.start.fired = false; } } } else if(com.mosesSupposes.fuse.FuseKitCommon._cbprops().indexOf("|" + i + "|") == -1) { com.mosesSupposes.fuse.FuseKitCommon.error("009",i); } } if(cbErrors.length > 0 && outputLevel > 0) { if(outputLevel > 0) { com.mosesSupposes.fuse.FuseKitCommon.error("010",callerIsEngine,cbErrors.length,cbErrors.toString()); } } return validCBs; } }